#include "parser.h"
#include "command.h"
#include "execute.h"
#include <stdlib.h>
#include "lexer.h"
#include "builtin.h"

int setenv(const char *nombre, const char *valor, int sobrescribir);

int main (void)
{
	pipeline * pl = NULL;
	Lexer * lex = NULL;

	setenv ("HOSTNAME", "grupo04", 1);


	while (true)
	{
		if (feof (stdin))
			salir ();
		else
		{
			printf("%s@%s:~%s$ ", getenv("USER"), getenv("HOSTNAME"), getenv("PWD"));
			lex = lexer_new (stdin);
			pl = parse_pipeline (lex);
			if (pl != NULL)
			{
				execute (pl);
				pipeline_destroy (pl);
			}
			lexer_destroy (lex);
		}
	}
	
	return 0;
}